/**
 * 
 */
package com.evon.yardmanagement.transformer;

import com.evon.yardmanagement.model.KeyBox;
import com.evon.yardmanagement.ui.dto.KeyBoxDTO;



/**
 * @author Sandeep
 *
 */
public class KeyBoxTransformer {
	
	public static KeyBox transformKeyBox(KeyBoxDTO keyBoxDto){
		KeyBox keyBox = new KeyBox();
		keyBox.setId(keyBoxDto.getKeyBoxId());
		keyBox.setName(keyBoxDto.getKeyBoxName());
		keyBox.setBoxNumber(keyBoxDto.getKeyBoxNumber());
		keyBox.setOccupied(keyBoxDto.getKeyBoxOccupied()?1:0);
		
		return keyBox;
	}

	public static KeyBoxDTO transformToModel(KeyBox keyBox){
		KeyBoxDTO keyBoxDTO = new KeyBoxDTO();
		keyBoxDTO.setKeyBoxId(keyBox.getId());
		keyBoxDTO.setKeyBoxNumber(keyBox.getBoxNumber());
		keyBoxDTO.setKeyBoxName(keyBox.getName());
		keyBoxDTO.setKeyBoxOccupied(keyBox.getOccupied()==1?true:false);
		keyBoxDTO.setKeyBoxActive(keyBox.getIsActive()==1?true:false);
		return keyBoxDTO;
	}
}
